<?php
namespace App\Module\Teacher\Service;

use App\Model\Child;

class ChildService {

    public function search($name,$pagesize){
        $query = Child::query()->latest("child_id");

        if(!empty($name)){
            $query->where('name','like','%'.$name.'%');
        }

        return $query->paginate($pagesize);
    }

    public function getById($id){
        return Child::query()->find($id);
    }
}